using System.Linq;
using Agatha.Common;
using IDAL;
using Source.Common;

namespace Source.ServiceLayer.Handlers
{
    public class HelloWorldHandler : NhRequestHandler<HelloWorldRequest, HelloWorldResponse>
	{
        private readonly IProject projectRepository;

        public HelloWorldHandler(IProject projectRepository)
        {
            this.projectRepository = projectRepository;
        }

        public override Response Handle(HelloWorldRequest request)
		{
			var response = CreateTypedResponse();
            response.Length = projectRepository.LoadAllProjects().Count();
			response.Message = "Hello World!";
            response.dto = projectRepository.LoadAllProjects();
			return response;
		}
	}
}